public List
Set<String> typeList = listTypeGroupByProjectUuid(assets.getProjectUuid());
List<String> types = new ArrayList<>();
types.add(AssetsType.FACT);
types.add(AssetsType.CONSTANT);
types.add(AssetsType.GUIDED_RULE);
types.add(AssetsType.RULE_TABLE);
types.add(AssetsType.RULE_TREE);
types.add(AssetsType.SCORECARD);
types.add(AssetsType.RULE_FLOW);
for (String type : types) {
typeList.remove(type);
}
for (String type : typeList) {
types.add(type);
}
int accountId = SessionHolder.currentAccount().getId();
List<Assets> assetsList = assetsMapper.selectByAssetNameAndFolderName(assets.getProjectUuid(),
assets.getName(),
dirName,
accountId ,
SessionHolder.hasAdminPermission() );
List dataList = new ArrayList();
for (String type : types) {
Map map = new HashMap();
List<Assets> list = new ArrayList<>();
map.put("type",type);
for(Assets assets1 : assetsList){
if(type.equals(assets1.getType())){
list.add(assets1);
}
}
map.put("list",list);
dataList.add(map);
}
return dataList;
}
SELECT t1.id, t1.uuid, t1.create_time, t1.update_time, t1.name, t1.description, t1.type, t1.project_uuid, t1.tag, t1.is_locked FROM t_assets t1 LEFT JOIN t_folder t2 ON t1.dir_parent_id = t2.uuid LEFT JOIN t_permission t3 ON t3.identifier = t1.id WHERE t1.project_uuid = #{projectUuid} AND !t1.is_deleted AND !t2.is_deleted AND t3.type = 2 AND t3.account_id = #{accountId} AND t3.permission != "" and t1.name like concat('%',#{name},'%') and t2.dir_name like concat('%',#{dirName},'%') 因为是关联查询,所以没在文件夹的文件,在关联查询时会查不到,所以要把文件夹查询放到判断语句里面以便获取全部文件。